package com.szt.school.config;

import java.io.FileWriter;
import java.io.IOException;

public class AlipayConfig {

    // 应用ID,您的APPID，收款账号即是您的APPID对应的支付宝账号,开发时使用沙箱提供的APPID，生产环境改成自己的APPID
    public static String APP_ID = "2021000123607014";   //你的沙箱APPID

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String APP_PRIVATE_KEY = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCp10+RqSyo5es8IiIZ1s0szOHyH+uugYnbUkzoh7zT8uu8rh46GeCPiiyQMjRpKOrbFOcXmCoSyKLSX+Pnx9FkiWCvP9ETbN5521Q3VcriP0yqE6Zaz09FrlDqB1Qjh/8A0ecP72UOu9XYQeRetXDPx2/tx73TLRl7yMYFJokNCyB9ctf7nJof9Ez0U8drZjO4SBNjelgwY6/31VyrHIPC9N8LJxXUJuV97z9RAG8f5RZkSPxDvlsQrPXcdkKzsbywd8zELF1NK4KFnHa36mSlyPD2+YjRgMyEdMyWviA1uWAV/lQYMG7CLHBTRZSKPTdJhtyr8Go4oJcxVXZ13fYdAgMBAAECggEAAJaZVPTUDcW2GeA4ZASFc2lGQxNvOoyCULspPwjxU36c6Gtl+WeLipO88cbqvY6Bub6JymAhjS0au0XPwUbE5+c96X18GOggoSVsVkC60ivL9S7aPahIKwKejyD1XqYi8PrJJRn8LJ/j7rrTsqxINsAHGDi/5JJcazxXyz7F7MCiqmW18+lKxlozB9iPjKHcmBDvV97f25ZFBXg151pbLJiqtXkUFcJzTh7/b/tJnMQOGceE3MMH73SmhSwAxus9jRio4mTJG2uVKzp5mk6xT4NhWuueo/LbtFgfPzx9MJjmbYp7p9Bkrdznl4WBx+NvdE7ujvCOxZ0ibl72qT5lQQKBgQDgTWKIx0/DHPP21YJ2f1ktfOzNvigdrugmHaF4ja4ucQgxTjaYcxJyaSHlK/XUC8hgqkrhMyGPP+69cfAea+kb53QSW23j7kjTti56TqzweU4d99140hKvi6ZIVZ3KuKT0n9K3vEHzyu03ri8plM+zVNbH9nyvr+ax+8CZj/1m0QKBgQDB16ysGzajiTus6AS/OWb9SoxudtZ7ZSUkphCCfh/sfhYPsebWp4ZHlQY82KoTsB389jFCODRBrj/wcLNPORpsh134YBghLHyFS+JVv75y0FpEj32LaOBoTZV2UTZokCZveadxK2IVLdk16KQsfIOvGXfX9HmxUZJfkHwEIrZFjQKBgHOPyxVXQsPulc71P8sXX3WtKD/0Gaz5YUfJ+lgm/reUqrjkaAJxPu7NNZZh6Lx/+ZO8COovsrmgIbtfCWxTAn3K6KVQj7RgHwtckGOZR0Z56QJNosBN0yy4UUpxOeOo7+vMr/7TslMNmNwYFNpifgQR0LqjRqgpgzztzNQROGgRAoGAW7eRswlZS/2l58UMYfJmIZjBY48FIvOTpIiSrTvCHSL3i0uQvqYbaglAH1AhARnGxqcyXXO8fgtVo42fue956joOo3PMVv32mRdzq0EDes3MuD3wmCLyc0eqXYZFqSnzlbFJIcn2KbE84j4GWCo+IH57bwn0/oprKJ5zn31RIw0CgYBa0yAHHCX03pbYO1T1DqZg67xO+fjlxsmhzB/6si86SNnIQfMRgEVNvPLVQLbTCu64hvnCSG/95kEGgLx96pSgT5d8qnF0qBnqbe9FRetRFxpwFiDbneVBJASRfeRagxl/okqga0RjUC15cKku/BhQ+44jMXBC1UJN/htvWEjqrg==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2g9ae3cGbB4Bx5piA9wkkBYRg5LJ0UoYREupOMcj7BvRmfxzRopQYD4q4OqssW+E9ZI1Re2SztYX8wJXZbfvqxD/KqKrg/zmQHn8mfbKAOus4mWiAA2m6R6hOTTZGHcjEWXn3AYj1GraZIt7meKiVRjqsztdgdPKyG8ukMh5IHVG5bHGnRIW8ggvwQ5fGUikyqxac+3qech9CzSoM9HADxcXEBC/fZOuFyjYkvbzG4AjHdiivc8ghK4dcxCuAULSRlYrwwa5maFYSclYJ3TpRlK+Xc7d1BsQjYckbYbP7XG8P29XRsAs1R1Zf+9OY9BPeckPxIJeT1A9AZYrGqGDaQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
//    public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";
    public static String notify_url = "http://localhost:80/springboot-dev/myPay/toNotify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问(其实就是支付成功后返回的页面)
//    public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";
    public static String return_url = "http://localhost:80/springboot-dev/myPay/succ";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String CHARSET = "utf-8";

    // 支付宝网关，这是沙箱的网关
    public static String gatewayUrl = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";

    // 日志存放的父级路径
    public static String log_path = "D:\\tmp\\";

//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
